﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.windows {
    import net.wooga.pets.views.windows.*;
    import net.wooga.pets.models.windows.factories.*;
    import net.wooga.pets.models.windows.builders.vo.*;
    import net.wooga.pets.models.windows.restricted.*;
    import net.wooga.pets.events.windows.*;
    import net.wooga.pets.models.windows.sun.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.models.windows.main.*;
    import net.wooga.pets.constants.windows.*;

    public class WindowCommand extends Command {

        private var _windowsViewFactory:IWindowsViewFactory;
        private var _currentModel:AbstractWindowsModel;
        public var defaultWindowsModel:DefaultWindowsModel;
        public var sunWindowsModel:SunWindowsModel;
        public var event:WindowCommandTriggerEvent;

        public function set windowsViewFactory(_arg1:IWindowsViewFactory):void{
            this._windowsViewFactory = _arg1;
        }
        protected function buildViewFromVo(_arg1:IWindowOptions):IWindowView{
            var _local2:IWindowView = this._windowsViewFactory.getViewByType(this.windowType);
            _local2.build(_arg1);
            return (_local2);
        }
        protected function get windowBuildOptions():IWindowOptions{
            return (((this.event.options) || (this.event.window.options)));
        }
        protected function get windowType():String{
            return (this.windowBuildOptions.windowViewType);
        }
        protected function get windowsModel():AbstractWindowsModel{
            return ((this._currentModel = ((this._currentModel) || (this.selectWindowModel()))));
        }
        protected function get windowToRemove():IWindowView{
            return (this.event.window);
        }
        private function selectWindowModel():AbstractWindowsModel{
            if (((this.windowBuildOptions) && ((this.windowBuildOptions.windowViewType == WindowsType.SUN_SPEECH_WINDOW)))){
                return (this.sunWindowsModel);
            };
            return (this.defaultWindowsModel);
        }

    }
}//package net.wooga.pets.controllers.windows 
